$(function(){

var data = [
      ['Java', '1', '降', '-0.01%'],
      ['C', '2', '升', '+2.44%'],
      ['Python', '3', '升', '+1.41%'],
      ['C++', '4', '降', '-2.58%'],
      ['C#', '5', '升', '+2.07%'],
      ['Visual Basic .NET', '6', '降', '-1.17%'],
      ['JavaScript', '7', '降', '-0.85%'],                            ];

  var container = $('.con');
  var hot = new Handsontable(container.get(0), {
        data: data,
        contextMenu: true,         
        manualRowResize : true,                 
        manualColumnResize : true,
        colWidths:150,
        rowWidths:100,
        className:'htCenter htMiddle',
        colHeaders: [
          '语言名称',
            '排名',
            '升或降',
            '变化幅度'
        
    ]        
      
  });
  
hot.addHook('afterSelectionEnd', function(){
      var i = arguments[0];
      var j = arguments[1];
      var obj = hot.getCellMeta(i,j).className;
      //console.log(obj);
      hot.setCellMeta(i, j, 'className','htLeft htTop');
      hot.render();
      //console.log(obj)
      hot.removeCellMeta(i,j,'className');   
     
})

  var myChart = echarts.init(document.getElementById('main'));
  //console.log(myChart)
  
  let xDate = [];
  let yDate = [6,9,8,8,7];

  for(let i=2000;i<=2020;i+=5){
    xDate.push(i);
  }

  // 指定图表的配置项和数据
  var option = {
      title: {
          text: 'JavaScript语言排名变化'
      },
      tooltip: {},
      legend: {
        data:['H(X)']
      },
      xAxis: {
        data:xDate
      },
      yAxis: {},
      series: [{
        name: '排名',
        type: 'line',
        //smooth:true,
        data: yDate
      }]
  };

  // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);
   return hot;

  })
